/**
 * 页面载入时设置投注的历史记录
 * type: 展示订单类型（1：未中奖，2已中奖，0：未开奖）
 * day : 展示投注的时间（today：今天， yesterday：昨天，all：全部）
 */
function setList(type, day){
	$('.tag_order_content').html('');
	// 页面载入填充页面内容
	var setContent  = '';
	var cd          = '全部';
	if($.isEmptyObject(resData.list)){
		setContent  = '	<div class="fullPageMsg">';
		setContent += '		<div class="fullPageIcon iconfont">　</div>';
		setContent += '		<p>暂无记录</p>';
		setContent += '	</div>';
		$('.tag_order_content').html(setContent);
		return;
	}
	
	// 翻转数组
	var reverseData = [];
	$.each(resData.list, function (i, v){
		reverseData.unshift(v);
	})
	var str         = '';
	// 期号开奖状态
	var kjStatus = 0;
	$.each(reverseData, function (key, value){
		// 检查是普通投注还是追号记录
		if( parseInt(value.is_chase) != $('#id_order_list li[class="on"]').index()){
			return true;
		}
		if(type == 1){
			if( value.status != 1 ) return true;
		}else if(type == 2){
			if( value.status != 2 ) return true;
		}else if(type == 0){
			if( value.status != 0 ) return true;
		}
		// 选择时间内的内容展示判断
		if(day == 'today'){
			cd = '今天';
			if( value.createtime < resData.other.today ) return true;
		}else if(day == 'yesterday'){
			cd = '昨天';
			if( value.createtime > resData.other.today || value.createtime < resData.other.yesterday ) return true;
		}else if(day == '7day'){
			cd = '七天';
		}
		str = '';
		
		$.each(value.period, function (i1, v1){
			var perAmount   = 0;
			var prizeAmount = 0;
			var perWinSta   = '未开奖';
			kjStatus        = 0;
			$.each(v1, function (i2, v2){
				if(kjStatus < v2.winner){
					kjStatus = v2.winner;
				}
				perAmount   += parseFloat(v2.item_money);
				prizeAmount += parseFloat(v2.prize);
			})
			if(kjStatus == 1) {
				perWinSta = '未中奖';
			}else if(kjStatus == 2){
				perWinSta = prizeAmount ? '+' + prizeAmount : '已中奖';
			}
			
			str += '<div>';
			str += '	<a class="active tag_show_detail" amt="' + value.id + '" amp="' + i1 + '">';
			str += '		<div>';
			str += '			<p>' + value.lott_title + '<span>￥' + perAmount.toFixed(2) + '</span></p>';
			str += '			<span>' + value.re_createtime + '</span>';
			str += '		</div>';
			str += '		<strong>' + perWinSta + '</strong>';
			str += '	</a>';
			str += '	<div class="hr1px"></div>';
			str += '</div>';
		})
		
		$('.tag_order_content').append(str);
	})
	if(str == ''){
		str  = '	<div class="fullPageMsg">';
		str += '		<div class="fullPageIcon iconfont">　</div>';
		str += '		<p>暂无记录</p>';
		str += '	</div>';
	}else{
		str     = '<div class="msg noMore">已显示' + cd + '全部记录</div>';
	}
	$('.tag_order_content').append(str);
}





